{layout "../Layout/layout.latte"}
{block tabs_content}
    {*{include "./tabs.latte"}*}
{/block}
{block custom}
    {include "../Public/custom.latte" , title1=>"选择执行人", title2=>"选择验收人"}
{/block}
{block private_js}
    <script type="text/javascript">
        $(function () {
            $("#limitAcorn").bind(function () {
                console.log(this);
            });

            $("#bnt").click(function () {
                $.ajax({
                    type: "post",
                    url: $("#formArticle").attr("action"),
                    data: $("#formArticle").serialize(),
                    cache: false,
                    dataType: "json",
                    success: function (data) {
                        console.log(data);
                        if (data.status == "y") {
                            $.toast(data.info);
                            setTimeout(function () {
                                location.replace(data.url);
                            }, 1000);

                        } else {
                            $.toast(data.info);
                            return false;
                        }
                    }
                });
            });


            // window.ids = new Array();
            window.department = new Array();
            // ids.push(0);
            // department.push("作为顶级部门");

            $.ajax({
                type: "post",
                url: "/ajaxDepartment",
                data: $("#formArticle").serialize(),
                cache: false,
                dataType: "json",
                async: false,
                success: function (data) {
                    console.log(data);
                    // ids = ids.concat(data.idsArr);
                    department = department.concat(data.departmentArr);
                }
            });

            $("#depSelector").picker({
                toolbarTemplate: '<header class="bar bar-nav">\
                <button class="button button-link pull-right close-picker">确定</button>\
                <h1 class="title">标题</h1>\
                </header>',
                cols: [
                    {
                        textAlign: 'left',
                        values: department
                    }
                ]
            });
        });

        function goback() {
            location.replace({url("mobileConsoles_user_company",array("active"=>"ZHIWEI"))})
        }
    </script>
    {include "../Public/customJs.latte"}
{/block}
{block private_css}
    <style>
        body, div, input, textarea{ font-size:0.75rem !important; }

        .item-title, input{ font-size:0.9rem; }
    </style>
{/block}
{block content}
    <form id="formArticle" class="stdform mform" method="post" action="{url("mobileConsoles_company_addStaffstation")}" onsubmit="return false">
        <div class="list-block">
            <ul>
                <li>
                    <div class="item-content">
                        <div class="item-media"><i class="icon icon-form-name"></i></div>
                        <div class="item-inner">
                            <div class="item-title label">职位名称</div>
                            <div class="item-input">
                                <input type="text" placeholder="名称" name="names">
                            </div>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="item-content">
                        <div class="item-media"><i class="icon icon-form-name"></i></div>
                        <div class="item-inner">
                            <div class="item-title label">职位人数</div>
                            <div class="item-input">
                                <input type="number" name="num">
                            </div>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="item-content">
                        <div class="item-media"><i class="icon icon-form-name"></i></div>
                        <div class="item-inner">
                            <div class="item-title label">所属部门</div>
                            <div class="item-input">
                                <input type="text" id='depSelector' name="department" value="请选择部门"/>
                            </div>
                        </div>
                    </div>
                </li>

                <li>
                    <div class="item-content">
                        <div class="item-media"><i class="icon icon-form-name"></i></div>
                        <div class="item-inner">
                            <div class="item-title label">是否限制</div>
                            <div class="item-input">
                                <label class="label-switch">
                                    <input type="checkbox" name="limitAcorn" id="limitAcorn">
                                    <div class="checkbox"></div>
                                </label>
                            </div>
                        </div>
                    </div>
                </li>

                <li>
                    <div class="item-content">
                        <div class="item-media"><i class="icon icon-form-name"></i></div>
                        <div class="item-inner">
                            <div class="item-title label">最高审核分数</div>
                            <div class="item-input">
                                <input type="text" placeholder="最高审核分数" name="riseAcorn" value="">
                            </div>
                        </div>
                    </div>
                </li>

                <li>
                    <div class="item-content">
                        <div class="item-media"><i class="icon icon-form-name"></i></div>
                        <div class="item-inner">
                            <div class="item-title label">职位描述</div>
                            <div class="item-input">
                                <textarea name="memo"></textarea>
                            </div>
                        </div>
                    </div>
                </li>

                <li>
                    <div class="item-content">
                        <div class="item-media"><i class="icon icon-form-name"></i></div>
                        <div class="item-inner">
                            <div class="item-title label">状态</div>
                            <div class="item-input">
                                <label class="label-switch">
                                    <input type="checkbox" name="status" checked>
                                    <div class="checkbox"></div>
                                </label>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </form>
    <div class="content-block">
        <div class="col-95">
            <div class="button button-big button-fill" id="bnt">提交</div>
        </div>
    </div>
    <div class="content-block">
        <div class="col-95">
            <a onclick="goback()" style="text-align: center;display: block;">返回</a>
        </div>
    </div>
{/block}